Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 29, 2021

Bumps bunit.web from 1.0.0-preview-01 to 1.0.0-preview-02.

Release notes

Sourced from bunit.web's releases.

1.0.0 - preview 02 - final release before v1

[1.0.0-preview-02] - 2021-03-26

The following sections list all changes in 1.0.0 preview 02.

The plan is to make this the last preview release of bUnit. If no big blocking bugs show up the next two weeks, a non-preview release of bUnit will be pushed out to the world.

Added

List of new features.

  • Added the ability to pass a "fallback IServiceProvider" to the TestServiceProvider, available through the Services property on a TestContext. The fallback service provider enables a few interesting scenarios, such as using an alternative IoC container, or automatically generating mocks of services components under test depend on. See the Injecting Services into Components Under Test page for more details on this feature. By @​thopdev in #310.

  • Added Task<Expection> ITestRenderer.UnhandledException property that returns a Task<Exception> that completes when the renderer captures an unhandled exception from a component under test. If a component is missing exception handling of asynchronous operations, e.g. in the OnInitializedAsync method, the exception will not break the test, because it happens on another thread. To have a test fail in this scenario, you can await the UnhandledException property on the TestContext.Renderer property, e.g.:

    using var ctx = new TestContext();
    var cut = ctx.RenderComponent<ComponentThatThrowsDuringAsyncOperation>();
    Task<Exception?> waitTimeout = Task.Delay(500).ContinueWith(_ => Task.FromResult<Exception?>(null)).Unwrap();
    Exception? unhandledException = await Task.WhenAny<Exception?>(Renderer.UnhandledException, waitTimeout).Unwrap();
    Assert.Null(unhandledException);

    In this example, we await any unhandled exceptions from the renderer, or our wait timeout. The waitTimeout ensures that we will not wait forever, in case no unhandled exception is thrown.

    NOTE, a better approach is to use the WaitForState or WaitForAssertion methods, which now also throws unhandled exceptions. Using them, you do not need to set up a wait timeout explicitly.

    By @​egil in #344.

  • Added a simple fake navigation manager, which is registered by default in bUnit's service provider. When the fake navigation manager's NavigateTo method is called, it does two things:

    1. Set the Uri property to the URI passed to the NavigateTo method (with the URI normalized to an absolute URI).
    2. Raise the LocationChanged event with the URI passed to the NavigateTo method.

    Lets look at an example: To verify that the <GoesToFooOnInit> component below calls the NavigationManager.NavigateTo method with the expected value, do the following:

    <GoesToFooOnInit> component:

    @inject NavigationManager NavMan
    @code {
      protected override void OnInitialized()
      {
        NavMan.NavigateTo("foo");
      }
    }

... (truncated)

Changelog

Sourced from bunit.web's changelog.

[1.0.0-preview-02] - 2021-03-26

The following section list all changes in 1.0.0 preview 02.

The plan is to make this the last preview release of bUnit. If no big blocking bugs show up the next two weeks, a non-preview release of bUnit will be pushed out to the world.

Added

List of new features.

  • Added the ability to pass a "fallback IServiceProvider" to the TestServiceProvider, available through the Services property on a TestContext. The fallback service provider enables a few interesting scenarios, such as using an alternative IoC container, or automatically generating mocks of services components under test depend on. See the Injecting Services into Components Under Test page for more details on this feature. By @​thopdev in #310.

  • Added Task<Expection> ITestRenderer.UnhandledException property that returns a Task<Exception> that completes when the renderer captures an unhandled exception from a component under test. If a component is missing exception handling of asynchronous operations, e.g. in the OnInitializedAsync method, the exception will not break the test, because it happens on another thread. To have a test fail in this scenario, you can await the UnhandledException property on the TestContext.Renderer property, e.g.:

    using var ctx = new TestContext();
    var cut = ctx.RenderComponent<ComponentThatThrowsDuringAsyncOperation>();
    Task<Exception?> waitTimeout = Task.Delay(500).ContinueWith(_ => Task.FromResult<Exception?>(null)).Unwrap();
    Exception? unhandledException = await Task.WhenAny<Exception?>(Renderer.UnhandledException, waitTimeout).Unwrap();
    Assert.Null(unhandledException);

    In this example, we await any unhandled exceptions from the renderer, or our wait timeout. The waitTimeout ensures that we will not wait forever, in case no unhandled exception is thrown.

    NOTE, a better approach is to use the WaitForState or WaitForAssertion methods, which now also throws unhandled exceptions. Using them, you do not need to set up a wait timeout explicitly.

    By @​egil in #344.

  • Added a simple fake navigation manager, which is registered by default in bUnit's service provider. When the fake navigation manager's NavigateTo method is called, it does two things:

    1. Set the Uri property to the URI passed to the NavigateTo method (with the URI normalized to an absolute URI).
    2. Raise the LocationChanged event with the URI passed to the NavigateTo method.

    Lets look at an example: To verify that the <GoesToFooOnInit> component below calls the NavigationManager.NavigateTo method with the expected value, do the following:

    <GoesToFooOnInit> component:

    @inject NavigationManager NavMan
    @code {
      protected override void OnInitialized()
      {
        NavMan.NavigateTo("foo");
      }
    }

    Test code:

... (truncated)

Commits
  • 97d2b1d Ensure docs projects have separate coding rules from src/test projects
  • 2797c2a Changed spaces to tabs
  • 44435f4 Updated release notes
  • 712d864 Merge branch 'main' into dev
  • 4f37ca4 Added additional bUnit JSInterop Setup methods, that makes it possible to g...
  • 19352b8 Added license/notices for files copied from aspnetcore repository. Closes #134
  • b43c250 Added delay in test to avoid failure on slow CI
  • 66c9d9e added bunit logo to nuget packages
  • 3e7f068 Updates to change log
  • 23382f0 Added setup suggestions to JSRuntimeUnhandledInvocationException message
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added .NET Pull requests that update .net code dependencies Pull requests that update a dependency file labels Mar 29, 2021
@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #412 (7554a59) into main (cde9eec) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #412   +/-   ##
=====================================
  Coverage   7.91%   7.91%           
=====================================
  Files        163     163           
  Lines       5674    5674           
=====================================
  Hits         449     449           
  Misses      5225    5225           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cde9eec...7554a59. Read the comment docs.

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Apr 12, 2021

Superseded by #455.

@dependabot dependabot bot closed this Apr 12, 2021
@dependabot dependabot bot deleted the dependabot/nuget/Gatekeeper.Client.Tests/bunit.web-1.0.0-preview-02 branch April 12, 2021 08:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dependencies Pull requests that update a dependency file .NET Pull requests that update .net code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant